<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: Andrey
  Date: 25.08.2014
  Time: 21:16
  To change this template use File | Settings | File Templates.
--%>

    <ul class="nav nav-tabs" role="tablist">
        <li class="active"><a href="#inbox" role="tab" data-toggle="tab">Inbox</a></li>
        <li><a href="#outbox" role="tab" data-toggle="tab">Outbox</a></li>
    </ul>
<div class="tab-content">
    <div class="tab-pane active" id="inbox">
        <div class="messages">
            <table class="table table-bordered table-hover">
                <c:forEach items="${currentUser.inbox}" var="message">
                    <tr  <c:if test="${message.readed eq false}">
                        class="info"
                    </c:if>>
                        <td width="150px">
                            <c:if test="${not empty message.sender.avaPath}">
                                <img src="${message.sender.avaPath}" width="32" height="32"/>
                            </c:if>
                            <c:if test="${empty message.sender.avaPath}">
                                <img src="https://vk.com/images/camera_200.gif" width="32" height="32"/>

                            </c:if>
                            <a href="<c:url value="/profile/${message.sender.userId}"/>">${message.sender.userLogin}</a>
                        </td>
                        <td>
                                ${message.messageText}
                        </td>
                        <td width="150px">
                            <fmt:formatDate value="${message.messageDate}" dateStyle="Medium" type="both"/>
                        </td>
                        <td>

                        </td>
                    </tr>

                </c:forEach>
            </table>
        </div>
    </div>
    <div class="tab-pane" id="outbox">
        <div class="messages" >
            <table class="table table-bordered table-hover">
                <c:forEach items="${currentUser.outbox}" var="message">
                    <tr  <c:if test="${message.readed eq false}">
                        class="info"
                    </c:if>>
                        <td width="150px">
                            <c:if test="${not empty message.reciver.avaPath}">
                                <img src="${message.reciver.avaPath}" width="32" height="32"/>
                            </c:if>
                            <c:if test="${empty message.reciver.avaPath}">
                                <img src="https://vk.com/images/camera_200.gif" width="32" height="32"/>

                            </c:if>
                            <a href="<c:url value="/profile/${message.reciver.userId}"/>">${message.reciver.userLogin}</a>
                        </td>
                        <td>
                                ${message.messageText}
                        </td>
                        <td width="150px">
                            <fmt:formatDate value="${message.messageDate}" dateStyle="Medium" type="both"/>
                        </td>
                        <td>

                        </td>
                    </tr>

                </c:forEach>
            </table>
        </div>
    </div>


</div>